/**
 * @author yanggjun
 */

TargetIndicator = {
	pos: {x: PlayMan.pos.x, y: PlayMan.pos.y, z: PlayMan.pos.z - 2*PlayMan.radius  },
	length: 1,
	height: 1,
	image: "image/top.jpg",
	indicator: '',
	add: function(){
		var indicatorTexture = new THREE.ImageUtils.loadTexture(this.image);
        var indicatorMaterial = new THREE.MeshBasicMaterial({
            color : "0xff0000"
        });
        var indicatorGeometry = new THREE.PlaneGeometry(this.length, this.height, 1, 1);
        var sphereGeometry = new THREE.SphereGeometry(0.5, 16, 16);
        this.indicator = new THREE.Mesh(sphereGeometry, indicatorMaterial);
        this.indicator.position.set(this.pos.x, this.pos.y, this.pos.z);
        this.indicator.doubleSided = true;
        this.indicator.rotation.x = Math.PI/2;
        World.scene.add(this.indicator);
	},
	move: function(dx,dy,dz){
//		var flag = PlayMan.direction.z > 0 ? 1 : -1;
		this.pos.x += dx;
		this.pos.y += dy;
		this.pos.z += dz;	
		this.indicator.position.set(this.pos.x, this.pos.y, this.pos.z);
	},
	rotate: function(){
		this.pos.x = PlayMan.pos.x + 2*PlayMan.radius * Math.sin(PlayMan.rot.y);
		this.pos.z = PlayMan.pos.z + 2*PlayMan.radius * Math.cos(PlayMan.rot.y);
		this.pos.y = PlayMan.pos.y + 2*PlayMan.radius * Math.sin(PlayMan.rot.x);
		this.indicator.position.set(this.pos.x, this.pos.y , this.pos.z);
	},
	
}